package cn.tta.controller.user;

import cn.tta.common.result.Result;
import cn.tta.pojo.entity.Category;
import cn.tta.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/user/category")
@RestController
@Slf4j
public class UserCategoryController {


    @Autowired
    private CategoryService categoryService;


    /**
     * 查询分类
     * @param type
     * @return
     */
    @GetMapping("/list")
    public Result list(Integer type) {
        List<Category> list = categoryService.list(type);
        return Result.success(list);
    }

}
